import 'package:flutter/material.dart';
import './basedome/image.dart';
import './basedome/text.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'FlutterDemo',
      home: new Scaffold(
          appBar: new AppBar(
            title: new Text('FlutterDemo'),
          ),
          body: DemoCaseList()),
    );
  }
}

class DemoCaseList extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      shrinkWrap: true,
      children: <Widget>[
        DemoItemRoute("文本示例", TextDemo()),
        DemoItemRoute("图片示例", ImageDemo()),
      ],
    );
  }
}

class DemoItemRoute extends StatelessWidget {
  final String name;
  final Widget view;
  const DemoItemRoute(this.name, this.view);
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        onTap: () {
          Navigator.of(context).push(MaterialPageRoute(builder: (context) {
            return this.view;
          }));
        },
        child: Container(
            padding: const EdgeInsets.all(12.0),
            decoration: BoxDecoration(
                border:
                    Border.all(width: 0.5, color: Color.fromARGB(11, 0, 0, 0))),
            child: Text(this.name,
                style: TextStyle(
                    fontSize: 16.0, color: Color.fromARGB(200, 0, 0, 0)))));
  }
}
